<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>删除部门信息</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/table.css">
</head>
<body>
	<sql:query var="result"
		sql="select dept_id,dept_name,dept_depict,dept_director,dept_staff_num,dept_setup_time from t_department" />
	<table>
		<caption>删除部门信息</caption>
		<thead>
			<tr>
				<th>部门名称</th>
				<th>部门描述</th>
				<th>部门负责人</th>
				<th>部门人数</th>
				<th>创建时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody id="tab">
			<c:forEach var="row" items="${result.rows}">
				<tr>
						<td>${row.dept_name}
						</td>
						<td><c:out value="${row.dept_depict}"/>
						</td>
						<td><c:out value="${row.dept_director}"/>
						</td>
						<td><c:out value="${row.dept_staff_num}"/>
						</td>
						<td><c:out value="${row.dept_setup_time}"/>
						</td>
						<td><a href="departmentAction!delDepartment.action?department.dept_id=${row.dept_id}">[删除]</a>
						</td>
				</tr>
			</c:forEach>
		</tbody>
		<tfoot><tr><td colspan="6"> 只有没有员工的部门才能删除</td></tr></tfoot>
	</table>
	
	<script type="text/javascript">
	<!--
		var Ptr = document.getElementById("tab").getElementsByTagName("tr");
		function $() {
			for (i = 1; i < Ptr.length + 1; i++) {
				Ptr[i - 1].style.backgroundColor = (i % 2 > 0) ? "#fff"
						: "#eee";
			}
		}
		window.onload = $;
		for ( var i = 0; i < Ptr.length; i++) {
			Ptr[i].onmouseover = function() {
				this.tmpClass = this.className;
				this.style.backgroundColor = "#ccc";

			};
			Ptr[i].onmouseout = function() {
				for (i = 1; i < Ptr.length + 1; i++) {
					Ptr[i - 1].style.backgroundColor = (i % 2 > 0) ? "#eee"
							: "#fff";
				}
			}
		}
	//-->
	</script>
</body>
</html>